<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Auth\Middleware\Authenticate as Middleware;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Session;

class Authenticate
{
  public function handle($request, Closure $next)
  {
    if ($request->session()->has('coreapi_token')) {
      return $next($request);
    }
    Log::debug($request->session()->all());

    return redirect()->route('login');
  }
}
